package cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.controller;

import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.entity.Employee;
import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.service.EmployeeService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



@RestController
public class EmployeeController {
    @Autowired
    private EmployeeService employeesService;
    @GetMapping("employees")
    public PageInfo<Employee> get(int pageNum, int pageSize, Employee employee) {
        return employeesService.get(pageNum,pageSize,employee);
    }

    @PostMapping("employees")
    public String save(@RequestBody Employee employee) {
        return employeesService.save(employee);
    }
    @PutMapping("employees")
    public String update(@RequestBody Employee employee) {
        return employeesService.update(employee);
    }
    @DeleteMapping("employees/{id}")
    public String delete(@PathVariable int id) {
        return employeesService.delete(id);
    }
}
